<template>
  <div class="no">
    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="没有更多了"
      @load="onLoad"
    >
      <ul class="all">
        <li v-for="item in data" :key="item.id" class="lis">
          <img :src="item.scene_pic_url" alt="" />
          <p class="p1">{{ item.title }}</p>
          <p class="p2">{{ item.subtitle }}</p>
          <p class="p3">{{ item.price_info }}元起</p>
        </li>
      </ul>
    </van-list>
  </div>
</template>

<script>
import { fish } from "@/api/home/index.js";
export default {
  data() {
    return {
      data: [],
      loading: false,
      finished: false,
      start: 1
    };
  },
  computed: {},
  //   created() {
  //     fish().then(res => {
  //       console.log(res);
  //       this.data = res.data;
  //     });
  //   },

  mounted() {},
  methods: {
    onLoad() {
      fish({
        page: this.start
      }).then(res => {
        console.log(res);
        this.data.push(...res.data);
        this.loading = false;
        this.start++;
        if (this.start > res.total) {
          this.finished = true;
        }
      });
    }
  }
};
</script>

<style scoped lang="scss">
.all {
  height: 6900px;
  background-color: #f5f5f5;
}
.lis {
  height: 330px;
  background-color: #fff;
  margin-bottom: 10px;
}
.all img {
  width: 375px;
  height: 220px;
}
.no {
  padding-bottom: 50px;
}
.p1 {
  font-size: 16px;
  color: black;
}
.p2 {
  font-size: 12px;
  color: #8c8c8c;
}
.p3 {
  color: brown;
  font-size: 14px;
}
</style>